import { createBrowserRouter, Navigate, redirect as Redirect } from 'react-router-dom'
import { WelcomePage } from "../pages/WelcomePage";
import { ArticlePage } from "../pages/ArticlePage";
import AppLayout from "../layout/AppLayout";
import LoginLayout from "../layout/LoginLayout";
import { SettingPage } from "../pages/SettingPage";
import { ConfigPage } from "../pages/ConfigPage";
import { AttachPage } from "../pages/AttachPage";
import { AboutPage } from "../pages/AboutPage";
import { ArticleEditPage } from '../pages/ArticleEditPage';
import LoginPage from '../pages/LoginPage';
import LifaUser from '../pages/LifaUser';
import LifaMoney from '../pages/LifaMoney';

export const appConfig = {
    path: '/',
    Component: AppLayout,
    children: [
        {
            path: '/',
            element: <Navigate to='/welcome'></Navigate>
        },
        {
            path: '/welcome',
            Component: WelcomePage
        },
        {
            path: '/articleList',
            Component: ArticlePage
        },
        {
            path: '/article',
            Component: ArticleEditPage
        },
        {
            path: '/article/:id',
            Component: ArticleEditPage
        },
        {
            path: '/setting',
            Component: SettingPage
        }, {
            path: '/config',
            Component: ConfigPage
        }, {
            path: '/attach',
            Component: AttachPage
        }, {
            path: '/about',
            Component: AboutPage
        }]
};

export const lifaConfig = {
    path: '/',
    Component: AppLayout,
    children: [
        {
            path: '/lifa_user',
            Component: LifaUser
        },
        {
            path: '/lifa_money',
            Component: LifaMoney
        }]
};

export const loginConfig = {
    path: '/login',
    Component: LoginLayout,
    children: [{
        path: '/login',
        Component: LoginPage
    }]
};

export const routers = createBrowserRouter([loginConfig,lifaConfig,appConfig]);